<template>
	
	<div class='bg-login'>
		<div class='login-form'>
			<el-form status-icon class="demo-ruleForm">

			  <h3>用户登录</h3>
			  <el-input v-model="userName" placeholder="请输入用户名"></el-input>
			  <el-input v-model="userPwd" placeholder="请输入密码"></el-input>
			  
			   <el-checkbox v-model="checked">记住密码</el-checkbox>

			  <el-form-item>
			    <el-button type="primary" @click="submitForm">提交</el-button>
			  </el-form-item>
			</el-form>
		</div>
	</div>
</template>
<script type="text/javascript">
export default{
	data(){
		return {
			checked:true,
			userName:"",
			userPwd:""
		}
	},
	methods:{
		submitForm(){
			let userName = this.userName;
			let userPwd = this.userPwd;
			this.$http.post('/api/user/selectUser',{
				userName,
				userPwd
			})
			.then((res)=>{
				let msg = res.data.msg;
				if(res.data.code==1){
this.$message({
      message: msg,
      type: 'success'
 });

this.$cookies.set('admin1',userName);


this.$router.replace({path:"/admin"})

	

				}else{
			this.$message.error(msg);
				}
			})
		}
	}
}
</script>
<style type="text/css" scoped="scoped">
.bg-login{
	background: url('../assets/loginimg.jpg') no-repeat;
	background-size:cover;
	width:100vw;
	height: 100vh;
	position: absolute;
}
.login-form{
	width:300px;
	height: 300px;
	box-shadow: 0 0 20px #ccc;
	padding:20px;
	margin:100px auto;
}
.login-form h3{
	margin-bottom:40px;
	text-align: center;
	color:#fff;
}
.login-form div,label{
	margin-bottom:20px;
}
</style>


